package com.wenan.data
{
	import com.wenan.ui.controls.flashMaps.MapEvent;
	
	import flash.events.EventDispatcher;
	import flash.events.MouseEvent;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;
	import mx.controls.Image;

	public class City extends EventDispatcher
	{
		private var _id:String;
		private var _name:String;
		private var _x:Number;
		private var _y:Number;
		private var _org:Array; //广场信息
		private var _image:Image=null;
		[Embed(source="images/city.png")]
		private var _imageSource:Class;
		
		public function City()
		{
			
		}

		public function get org():Array
		{
			return _org;
		}

		public function set org(value:Array):void
		{
			_org = value;
		}

		public function get id():String
		{
			return _id;
		}

		public function set id(value:String):void
		{
			_id = value;
		}

		public function get name():String
		{
			return _name;
		}

		public function set name(value:String):void
		{
			_name = value;
		}

		public function get x():Number
		{
			return _x;
		}

		public function set x(value:Number):void
		{
			_x = value;
		}

		public function get y():Number
		{
			return _y;
		}

		public function set y(value:Number):void
		{
			_y = value;
		}

		public function get image():Image
		{
			if(_image==null)
			{
				_image=new Image();
				_image.height=27;
				_image.width=12;
				_image.x=x;
				_image.y=y;
				_image.source=_imageSource;
				_image.addEventListener(MouseEvent.CLICK,click_handle);
			}
			return _image;
		}
	
		private function click_handle(event:MouseEvent):void
		{
			dispatchEvent(new MapEvent(MapEvent.CLICK_CITY,this));
		}

	}
}